package com.ym.controller.soso;

import com.github.pagehelper.PageInfo;
import com.ym.common.constant.Constants;
import com.ym.common.utils.page.PageDomain;
import com.ym.core.annotation.Log;
import com.ym.core.domain.APIResponse;
import com.ym.core.domain.BaseController;
import com.ym.soso.domain.param.ChinaMedicineMobileQueryParam;
import com.ym.soso.domain.vo.ChinaMedicineVO;
import com.ym.soso.service.IChinaMedicineSV;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;


@Api(tags = "APP-中医堂")
@Controller
@RequestMapping(value = "/soso/chinaMedicine", headers = Constants.Api.VERSION)
@Validated
public class ChinaMedicineController extends BaseController {

	@Autowired
	private IChinaMedicineSV chinaMedicineSV;


	@ApiOperation("查询中医堂信息列表")
	@Log(dataBase = false, printBody = false, printQuery = true)
	@GetMapping("/list")
	public APIResponse<PageInfo<ChinaMedicineVO>> list(@Valid ChinaMedicineMobileQueryParam queryParam) {
		PageDomain.startPage();
		List<ChinaMedicineVO> list = chinaMedicineSV.selectCustomerByModel(queryParam);
		return successPage(list);
	}

	@ApiOperation("详情")
	@Log(dataBase = false, printBody = false, printQuery = true)
	@GetMapping(value = "/info")
	public APIResponse<ChinaMedicineVO> info(@RequestParam Long id) {
		return successData(chinaMedicineSV.infoPc(id));
	}

}
